using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;
namespace MicroMsg.Storage
{
	[Table]
	public class SnsTagInfo : StorageItem
	{
		[Column(IsPrimaryKey = true)]
		public string strTagID;
		[Column]
		public string strTagName;
		[Column]
		public int nCount;
		[Column(DbType = "Image")]
		public byte[] bytesXmlMemberList;
		[Column(IsVersion = true)]
		private Binary _version;
		private SnsTagMemberList _memberList;
		public SnsTagMemberList memberList
		{
			get
			{
				if (this._memberList != null)
				{
					return this._memberList;
				}
				if (this.bytesXmlMemberList != null)
				{
					this._memberList = StorageXml.loadFromBuffer<SnsTagMemberList>(this.bytesXmlMemberList);
				}
				if (this._memberList == null)
				{
					this._memberList = new SnsTagMemberList();
				}
				return this._memberList;
			}
			set
			{
				this._memberList = value;
				this.memberListFlush();
			}
		}
		public ulong nTagID
		{
			get
			{
				return Convert.ToUInt64(this.strTagID, 16);
			}
			set
			{
				this.strTagID = value.ToString("X16");
			}
		}
		public override void merge(object object_0)
		{
			SnsTagInfo snsTagInfo = object_0 as SnsTagInfo;
			this.strTagName = snsTagInfo.strTagName;
			this.nCount = snsTagInfo.nCount;
			this.bytesXmlMemberList = snsTagInfo.bytesXmlMemberList;
			this._memberList = null;
		}
		public void memberListFlush()
		{
			if (this._memberList != null && this._memberList.list.get_Count() > 0)
			{
				this.bytesXmlMemberList = StorageXml.saveToBuffer<SnsTagMemberList>(this._memberList);
				return;
			}
			this.bytesXmlMemberList = null;
		}
	}
}
